package cn.wolfcode.luowowo.acticle.mapper;

import cn.wolfcode.luowowo.acticle.domain.Commodity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CommodityMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Commodity record);

    Commodity selectByPrimaryKey(Integer id);

    List<Commodity> selectAll();

    int updateByPrimaryKey(Commodity record);

    /**
     * 根据商品ID 修改 商品数量
     * @param id
     */
    void updateNumberByPrimaryKey(Long id);

    /**
     * 维护表关系
     * @param userId
     * @param commodityId
     */
    void insertRelation(@Param("userId") Long userId,@Param("commodityId")Long commodityId);

    /**
     * 根据当前用户id获取当前用户拥有的道具
     * @param id
     */
    List<Commodity> selectUserOwnedGoodsById(Long id);

    int selectUserIsOwenGood(Long cid, Long uid);
}